/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.workforce.common.tags;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

/**
 *
 * @author neo
 */
public class ActionBarTag extends TagSupport {

    private String span;

    @Override
    public int doStartTag() throws JspException {
        JspWriter out = pageContext.getOut();
        StringBuffer s = new StringBuffer();
        if (span != null) {
            s.append("<tr><td colspan=\"").append(span).append("\">");
        } else {
            s.append("<tr><td>");
        }
        try {
            out.print(s.toString());
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return EVAL_BODY_INCLUDE;
    }

    @Override
    public int doEndTag() throws JspException {
        JspWriter out = pageContext.getOut();
        try {
            out.print("</td></tr>");
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return super.doEndTag();
    }

    public void setSpan(String span) {
        this.span = span;
    }
}
